import Vue from 'vue';
import Router from 'vue-router';

import Login from "../views/Login";
import Home from "../views/Home";
import ProductInfo from "../views/ProductInfo";
import ProductList from "../views/ProductList";
Vue.use(Router);

export default new Router({
  routes:[
    {
    //路由路径
    path:'/login',
    //路由名称
    name:'Login',
    //跳转到组件
    component: Login
  },
    {
      path: "/logout",
      redirect:"/login"
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      children:[
        {
          path: '/productList',
          name: 'productList',
          component: ProductList,
        },
        {
          path: '/productInfo/:id',
          name: 'productInfo',
          component: ProductInfo,
        }
      ]
    }
  ]
})
